package org.penguin.study.bk.web.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@Slf4j
@WebFilter(filterName = "SimpleFilter", initParams = {@WebInitParam(name = "name", value = "程英华")}, urlPatterns = {"/hiServlet"})
public class SimpleFilter implements Filter {
    public void init(FilterConfig config) throws ServletException {
        log.info("Web Filter初始化");
    }

    public void destroy() {
        log.info("Web Filter被销毁");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        log.info("处理过滤请求前的......");
        chain.doFilter(request, response);
        log.info("处理过滤请求后的......");
    }
}
